import request from '@/utils/request'

// 获取所有发行商信息
export const getPublisherListAPI = () => {
  return request.get('/audit/publisher/list')
}

// 获取所有待审核发行商列表
export const getPendingPublisherListAPI = () => {
  return request.get('/audit/publisher/list/pending')
}


// 更新发行商状态
export const updatePublisherStatusAPI = (data: { id: number, status: number,remark: string }) => {
  return request.post('/audit/publisher/status', data)
}


// 上传营业执照
export const uploadBusinessLicenseAPI = (file: File, id: number) => {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('id', id.toString())
  return request.post('/publisher/uploadLicense', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 新增发行商
export const addPublisherAPI = (data: { name: string, phone: string, email: string, licenseFile: string, status: number ,remark:string}) => {
  return request.post('/publisher/insert', data)
}

// 根据id查询发行商信息
export const getPublisherByIdAPI = (id: number) => {
  return request.get(`/publisher/${id}`)
}

// 根据用户ID查询发行商
export const getPublisherByUserIdAPI = () => {
  return request.get(`/publisher/user`)
}
